package com.epalmpay.commom;

import com.epalmpay.entity.Response;
import com.epalmpay.service.common.IExpressInfoService;
import com.epalmpay.util.Tools;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/manager/express")
public class ExpressInfoController {
    @Resource
    private IExpressInfoService expressInfoService;

    @RequestMapping(value = "/getExpressShortName", method = RequestMethod.POST)
    public Response getExpressShortName(@RequestBody String expressName) {
        if(Tools.isEmpty(expressName)) {
            return Response.getError("参数非法");
        }
        return expressInfoService.getExpressShortName(expressName.trim());
    }

    @RequestMapping(value =  "/getExpressShortName", method = RequestMethod.GET)
    public Response getExpressShortName1(@RequestParam String expressName) {
        if(Tools.isEmpty(expressName)) {
            return Response.getError("参数非法");
        }
        return expressInfoService.getExpressShortName(expressName.trim());
    }

    @RequestMapping(value = "/getExpressDetail", method = RequestMethod.POST)
    public Response getExpressDetail(@RequestBody Long orderId) {
        if(orderId == null) {
            return Response.getError("参数非法");
        }
        return expressInfoService.getExpressDetail(orderId);
    }

    @RequestMapping(value = "/getExpressDetail", method = RequestMethod.GET)
    public Response getExpressDetail1(@RequestParam Long orderId) {
        if(orderId == null) {
            return Response.getError("参数非法");
        }
        return expressInfoService.getExpressDetail(orderId);
    }
}
